<?php
	$con = mysql_connect("localhost:3306","root","shibani");
	if (!$con)
	{
		die('Could not connect: ' . mysql_error());
	}

	mysql_select_db("cal2sync", $con);

	$id = mysql_query("SELECT u_id FROM user WHERE username = '".$_POST['username']."'");
	while($row = mysql_fetch_array($id))
	{
		$uid = $row['u_id'];
	}
	
	$str = "";
	$result = mysql_query("SELECT action, event_type FROM rules WHERE u_id = '".$uid."'");
	while($row=mysql_fetch_array($result))
	{
		$action = $row['action'];
		$event = $row['event_type'];
		$str = $str . "{" . $event . "," . $action . "};";
		
	}
	
	mysql_close($con);
	
	echo $str;
?>